home *** CD-ROM | disk | FTP | other *** search
/ Nejlepší hry / Nejlepsi hry.iso / hry / sea of chaos / sea_install.msi / _15C39AAA7726369D39812BD40F01CF6A / _876810A3169A458089717DFA1B13195D < prev    next >
Encoding:
Text File  |  2004-10-22  |  908 b   |  46 lines

  1. //basic do-little shader
  2. //1 directional light applied
  3.  
  4. //Luke Lenhart
  5. //(C)2004-2005 Digipen Institute of Technology
  6.  
  7. //combined world,view,projection transform
  8. float4x4 matWorldViewProj;
  9.  
  10. //directional light (assumed to be the sun)
  11. float4 lgtDirection;
  12. float4 lgtDiffuse;
  13. float4 lgtAmbient;
  14.  
  15. //shader input
  16. struct VS_INPUT
  17. {
  18.     float4 Pos : POSITION;
  19.     float4 Normal : NORMAL;
  20.     float2 Tex0 : TEXCOORD0;
  21. };
  22.  
  23. //shader output
  24. struct VS_OUTPUT
  25. {
  26.     float4 Pos : POSITION;
  27.     float4 Color : COLOR;
  28.     float2 Tex0 : TEXCOORD0;
  29. };
  30.  
  31. //shader code
  32. VS_OUTPUT VShader(VS_INPUT In)
  33. {
  34.     VS_OUTPUT Out;
  35.     
  36.     //calc directional light color
  37.     Out.Color=dot(In.Normal,lgtDirection)*lgtDiffuse + lgtAmbient;
  38.     
  39.     //calc transformed position and copy texture coord
  40.     Out.Pos=mul(matWorldViewProj,In.Pos);
  41.     Out.Tex0=In.Tex0;
  42.   
  43.     //spit out the results
  44.     return Out;
  45. }
  46.